////////////////////////////////////////////////////////////////////////////////////////////////////
/// Copyright (c) 2009 - 2010 RacoonStudios
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
/// software and associated documentation files (the "Software"), to deal in the Software
/// without restriction, including without limitation the rights to use, copy, modify, merge,
/// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
/// to whom the Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all copies or
/// substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once
#ifndef mime_h__
#define mime_h__

#include "core/types.h"
#include "helper/string.h"

namespace IO
{
	////////////////////////////////////////////////////////////////////////////////////////////////////
	/// \class	MIME
	///
	/// \brief	This is just an engine intern representation of the MIME data format.
	///
	/// 
	/// \author	Markus
	/// \date	02.02.2010
	////////////////////////////////////////////////////////////////////////////////////////////////////
	class MIME
	{
	public:

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	MIME()
		///
		/// \brief	Constructor. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		////////////////////////////////////////////////////////////////////////////////////////////////////
		MIME();

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	MIME(const Helper::String & both)
		///
		/// \brief	Constructor. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	both	The String containing type and subtype. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		MIME(const Helper::String & both);

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	MIME(const Helper::String & type, const Helper::String & subtype)
		///
		/// \brief	Constructor. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	type	The type. 
		/// \param	[in]	subtype	The subtype. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		MIME(const Helper::String & type, const Helper::String & subtype);

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	MIME(const MIME & rhs)
		///
		/// \brief	Constructor. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	rhs	The right hand side object. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		MIME(const MIME & rhs);




		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	void operator= (const MIME & rhs)
		///
		/// \brief	Copy operator. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	rhs	The right hand side object. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		void operator = (const MIME & rhs);

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	bool operator== (const MIME & rhs) const
		///
		/// \brief	Equality operator. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	rhs	The right hand side object. 
		///
		/// \return	True if both MediaTypes are equal, otherwise false.
		////////////////////////////////////////////////////////////////////////////////////////////////////
		bool operator == (const MIME & rhs) const;

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	bool operator!= (const MIME & rhs) const
		///
		/// \brief	Inequality operator. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	rhs	The right hand side object. 
		///
		/// \return	True if both MediaTypes are inequal, otherwise false.
		////////////////////////////////////////////////////////////////////////////////////////////////////
		bool operator != (const MIME & rhs) const;




		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	bool IsValid() const
		///
		/// \brief	Determines if this MediaType is valid.
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \return	True if the MediaType is valid, otherwise false.
		////////////////////////////////////////////////////////////////////////////////////////////////////
		bool IsValid() const;




		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	void Set(const Helper::String & both)
		///
		/// \brief	Sets type and subtype of the MediaType. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	both	A String containg type as well as the subtype. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		void Set(const Helper::String & both);

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	void Set(const Helper::String & type, const Helper::String & subtype)
		///
		/// \brief	Sets both, the type and the subtype of the MediaType.. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	type	The type of the MediaType. 
		/// \param	[in]	subtype	The subtype of the MediaType. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		void Set(const Helper::String & type, const Helper::String & subtype);

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	void SetType(const Helper::String & type)
		///
		/// \brief	Sets the type. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	type	The type. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		void SetType(const Helper::String & type);

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	void SetSubType(const Helper::String & subtype)
		///
		/// \brief	Sets the subtype. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	subtype	The subtype. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		void SetSubType(const Helper::String & subtype);

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	const Helper::String & Get() const
		///
		/// \brief	Returns the MediaType as one String.
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \return	A String containing the type and subtype.
		////////////////////////////////////////////////////////////////////////////////////////////////////
		const Helper::String & Get() const;

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	const Helper::String & GetType() const
		///
		/// \brief	Returns the type. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \return	The type. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		const Helper::String & GetType() const;

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	const Helper::String & GetSubType() const
		///
		/// \brief	Returns the subtype. 
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \return	The subtype. 
		////////////////////////////////////////////////////////////////////////////////////////////////////
		const Helper::String & GetSubType() const;

	protected:

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	protected: const Helper::String & Bind() const
		///
		/// \brief	Binds all element together to just one String which then will be
		///			returned.
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \return	A String containing all elements of the mime.
		////////////////////////////////////////////////////////////////////////////////////////////////////
		const Helper::String & Bind() const;

		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// \fn	void Split(const Helper::String & both)
		///
		/// \brief	Splits the String up into the type and subtype of the MediaType.
		///
		/// \author	Markus
		/// \date	02.02.2010
		///
		/// \param	[in]	both	The String which contains type and subtype.
		////////////////////////////////////////////////////////////////////////////////////////////////////
		void Split(const Helper::String & both);


		Helper::String m_type;
		Helper::String m_subType;

	private:

	};

}

#endif // mime_h__